package com.example.frameanimation;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {
    private ImageView mImgv;
    private AnimationDrawable drawable;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mImgv = (ImageView) findViewById(R.id.imgv);
        mImgv.setBackgroundResource(R.drawable.frame_anim);
        drawable = (AnimationDrawable)mImgv.getBackground();
        drawable.start();
    }

    @Override
    protected void onStop() {
        super.onStop();
        drawable.stop();

    }
}
